<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>2.5.v-if指令（操作DOM元素）</title>
    <script src="vue.js"></script>
</head>

<body>
    <div id="app">
        <input type="button" value="切换显示" @click="toggleIsShow">
        <p v-if="isShow">Vue，v-if操控DOM树消耗较大</p>
        <p v-show="isShow">Vue,v-show更适用于频发切换的</p>
        <h2 v-if="tempertrue>=35">默认35，值设定小于35的话，v-if直接在DOM树中不显示标签</h2>
    </div>
    <script>
        let app = new Vue({
            el: "#app",
            data: {
                isShow: true,
                tempertrue: 40,
            },
            methods: {
                toggleIsShow: function () {
                    this.isShow = !this.isShow;
                },
            },
        });
    </script>
</body>

</html>